package kite.springcloud.stream.kafka.customer.listener;

import kite.springcloud.common.stream.ShopChannelProcess;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * 消息消费者
 */
@Slf4j
@Component
public class ShopMessageListener {

    /**
     * StreamListener
     * 注解可以监听输入通道里的消息内容,
     * 注解里面的属性指定我们刚才定义的输入通道名称,
     * 而MessageChannel可以通过输出通道发送消息
     *
     * @param message message
     */
    @StreamListener(ShopChannelProcess.SHOP_TOPIC_INPUT)
    public void receiveShopMessage(Message<String> message) {
        log.info("shop接收消息并消费receiveShopMessage={}", message.getPayload());
    }

}